package com.mxsoft.concurrent;

public class SynchronizedDemo {

    Object obj = new Object();

    public void m1() {
        System.out.println("m1");
        synchronized (obj) {
            System.out.println(Thread.currentThread().getName());
        }
    }

    public void m2() {
        synchronized (obj) {
            System.out.println("m2");
            m1();
        }
    }

    public static void main(String[] args) {
        SynchronizedDemo demo = new SynchronizedDemo();
        demo.m2();
    }
}
